﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TrainingRequest.Models.TrainingsRequests>" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="TrainingRequest.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Создание новой заявки
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Создание новой заявки</h2>

<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>

<% Html.RenderAction("NewRequestPartial"); %>

<% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset style="max-width:500px;">
        <legend>Новая заявка</legend>

        <div class="editor-label"> Расписание курсов </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().ComboBox( settings => {
                                                            settings.Name = "IdTrainingsSchedule";
                                                            settings.Width = 500;
                                                            settings.SelectedIndex = 1;
                                                            settings.Properties.DropDownWidth = 500;
                                                            settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                                                            //settings.CallbackRouteValues = new { Controller = "Editors", Action = "MultiColumnComboBoxPartial" };
                                                            settings.Properties.EnableCallbackMode = true;
                                                            settings.Properties.CallbackPageSize = 30;
                                                            settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                            settings.Properties.TextFormatString = "{1}";
                                                            settings.Properties.ValueField = "IdTrainingsSchedule";
                                                            settings.Properties.ValueType = typeof(int);
                                                            settings.Properties.Columns.Add("PlannedDate", "Дата", Unit.Percentage(30));
                                                            settings.Properties.Columns.Add("CourseName", "Название курса ", 50);                                                        
                                                            settings.Properties.Columns.Add("profineRegionName", "Регион", 50);
                                                            //settings.Properties.Columns.Add("Phone", "Phone", 100);
                                                          }).BindList(DB.TrainingsSchedules.OrderByDescending(p => p.PlannedDate)).Bind(Model.IdTrainingsSchedule).GetHtml()
            %>
        </div>

        <%--<div class="editor-label"> Дата курса </div>
        <div class="editor-field">
             <%: Html.DevExpress().DateEdit(
                            settings => {
                                settings.Name = "RequestDate";
                                settings.Properties.DisplayFormatString = "D";
                            }).Bind(Model.RequestDate).GetHtml()%>
        </div>--%>

        <div class="editor-label"> Компания </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Company";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите название компании...";
                    }).GetHtml()
            %>
        </div>

        <div class="editor-label"> ФИО контактного лица </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "ContactName";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите имя контактного лица...";
                    }).GetHtml()
            %>
        </div>

        <div class="editor-label"> Контактный телефон </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "ContactPhone";
                        settings.Width = 500;
                        settings.Properties.MaskSettings.Mask = "+7 (999) 000-00-00";
                        settings.Properties.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.None;
                    }).GetHtml()
            %>
        </div>

        <div class="editor-label"> Адрес электронной почты </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "ContactEmail";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите адрес электронной почты";
                    }).GetHtml()
            %>
        </div>

        <div class="editor-label"> Комментарии </div>
        <div class="editor-field">
            <%:
                @Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Comments";
                        settings.Width = 500;
                        settings.Properties.NullText = "Комментарии...";
                    }).GetHtml()
            %>
        </div>

        <p>
            <input type="submit" value="Создать" />
        </p>
    </fieldset>
<% } %>

<div>
    <%: Html.ActionLink("Отмена", "Index") %>
</div>

</asp:Content>
